#ifndef USERWINDOW_H
#define USERWINDOW_H

#include <QWidget>
#include "databasefunction.h"
#include "qpushbutton.h"
#include "substationinfowindow.h"
#include "buywindow.h"
#include <QTimer>
namespace Ui {
class UserWindow;
}

class UserWindow : public QWidget
{
    Q_OBJECT

public:
    explicit UserWindow(QWidget *parent = nullptr);

    ~UserWindow();

signals:
    void sendSubStationInfo(QSqlQuery);
    void sendTrainNum(QString,QString);

private slots:
    void on_revisePsw_clicked();

    void on_mainPageBtn_clicked();

    void on_confirmRevise_clicked();

    void receiveData(QString);

    void on_loguot_clicked();

    void on_trainNum_clicked();

    void on_station2Station_clicked();

    void on_leftTickets_clicked();

    void on_alreadyPay_clicked();

    void on_unpay_clicked();

    void on_trainNumBtn_clicked();

    void disPlayTrainInfoByTrainNum(int,int);
    void disPlayTrainInfoByStation(int,int);
    void disPlayBuyWindow(int,int);

    void on_stationSearchBtn_clicked();

    void on_queryTrainNumBtn_clicked();

    void on_queryStationSearchBtn_clicked();

    void returnBtnSlot();
    void payBtnSlot();
    void delBtnSlot();
    void buyBtnSlot();

    void on_viewPersonalInfo_clicked();

    void on_reviseBtn_clicked();

    void on_saveBtn_clicked();

    void on_male_stateChanged(int arg1);

    void on_female_stateChanged(int arg1);

    void on_qssCheckBox_stateChanged(int arg1);

    void onTimeOut();

    void on_profitBtn_clicked();

private:
    Ui::UserWindow *ui;
    QString username;
    DatabaseFunction *db;
    SubStationInfoWindow *subWindow=new SubStationInfoWindow;
    QPushButton *pBtn = new QPushButton("购买");
    BuyWindow *buyWindow=new BuyWindow;
    QTimer *timer;

    QString processTrainNum(QString trainNum);

    void initPersonalInfo();
    void createCharts();
    void disCharts();

    bool isEdit=false;
    int  xPos=0;

};

#endif // USERWINDOW_H
